'''
Created on 05/12/2011

@author: Mateo
'''

class Page(object):
    '''
    classdocs
    '''


    def __init__(self,numb,lenght):
        '''
        Constructor
        '''
        self.size=lenght
        self.number=numb
        self.free=numb
        
    def getNumber(self):
        return self.number
    
    
    def getSize(self):
        return self.size
    
    def registerAllocation(self):
        actual=self.free
        last= self.number + self.size
        if self.free== self.number:
            self.free+=1
            return actual
        elif  actual <= last:
            self.free+=1        
            return actual
        else:
            last + 1